<!DOCTYPE html>
<html class="x-admin-sm">
    <#include "/common/common.html">
    <body>
        <div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">演示</a>
            <a>
              <cite>导航元素</cite></a>
          </span>
          <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
            <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
        </div>

        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">、
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" id="name"  placeholder="供应商名称" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-header">
                            <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
                            <button class="layui-btn" onclick="xadmin.open('添加用户','${path}/member-add.html',600,400)"><i class="layui-icon"></i>添加</button>
                        </div>
                        <div class="layui-card-body layui-table-body layui-table-main">
                            <table id="demo" lay-filter="test"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script type="application/javascript">
        $(function (){
            layui.use('table', function(){
                var table = layui.table;
                //第一个实例
                table.render({
                    elem: '#demo',
                    method: "POST",
                    url: '${path}/manufacturer/dataList',
                    where: {
                        "name": $("#name").val()
                    },
                    page: true,
                    request: {
                        pageName: 'pageNum', //页码的参数名称，默认：page
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    parseData: function(res){
                        debugger
                        return {
                            "code": res.code, //解析接口状态
                            "msg": res.message, //解析提示文本
                            "count": res.total, //解析数据长度
                            "data": res.data.item //解析数据列表
                        };
                    },
                    cols: [[ //表头
                        {field: 'id', title: '标识', width:80, sort: true, fixed: 'left'}
                        ,{field: 'name', title: '供应商名称', width:80}
                        ,{field: 'option', title: '操作', width: 135, templet: function (row) {
                                return "<button className=\"layui-btn layui-btn layui-btn-xs\"\n" +
                                    "onClick=\"xadmin.open('编辑','admin-edit.html')\"><i className=\"layui-icon\"></i>编辑\n" +
                                    "</button>\n" +
                                    "<button className=\"layui-btn-danger layui-btn layui-btn-xs\"\n" +
                                    "onClick=\"member_del(this,'要删除的id')\" href=\"javascript:;\"><i\n" +
                                    " className=\"layui-icon\"></i>删除</button>";
                            }}
                    ]]
                });
            });
        })

    </script>
</html>